import { useContext } from 'react';
import { AdaptiveSheetGestureHandlersContext, AdaptiveSheetGestureHandlersContextType } from '../contexts/gesture';

export const useAdaptiveSheetGestureHandlers = (): AdaptiveSheetGestureHandlersContextType => {
  const context = useContext(AdaptiveSheetGestureHandlersContext);

  if (context === null) {
    throw "'useAdaptiveSheetGestureHandlers' cannot be used out of the AdaptiveSheet!";
  }

  return context;
};
